Skip to content

Add autocomplete support for API allowedValues#219

Open
dheeraj12347 wants to merge 1 commit into
apache:mainfrom
dheeraj12347:feature/allowed-values-discovery
Open

Add autocomplete support for API allowedValues#219
dheeraj12347 wants to merge 1 commit into
apache:mainfrom
dheeraj12347:feature/allowed-values-discovery

Conversation

@dheeraj12347

Copy link
Copy Markdown

What does this PR do?

This PR adds support for using the allowedvalues metadata exposed by CloudStack API discovery to provide direct value autocompletion in CloudMonkey.

Changes

  • Add AllowedValues to the APIArg struct.
  • Parse the allowedvalues field from the API discovery response in UpdateCache().
  • Use AllowedValues during autocompletion before falling back to the existing findAutocompleteAPI() heuristic.

Behavior

When a parameter exposes allowedvalues through API discovery, CloudMonkey now suggests those values directly.

For example:

create snapshotpolicy intervaltype=

Pressing TAB now suggests values such as:

HOURLY
DAILY
WEEKLY
MONTHLY

Parameters that do not expose allowedvalues continue to use the existing autocomplete behavior, so there is no behavioral change for parameters without this metadata.

Related

Builds on the API discovery changes introduced in apache/cloudstack#13543.

Comment thread config/cache.go
Name string
Type string
Related []string
AllowedValues []string

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any rationale to add it in the middle?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants